package special_tree;

import code.CodeList;
import code.Opcode;
import lexer.Token;
import tree.ClassScope;
import tree.IdentifierScope;
import tree.MethodScope;
import tree.MyTree;
import tree.NamingException;
import tree.Type;
import tree.TypingException;

public class DeclTree extends MyTree {

	@Deprecated
	private Type typ;
	@Deprecated
	private int localVar;
	
	public DeclTree(Token token, Type typ, int localVar) {
		super(token);
		this.typ = typ;
		this.localVar = localVar;
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#analyzeNames(tree.IdentifierScope, tree.MethodScope, tree.ClassScope)
	 */
	@Override
	@Deprecated
	public void analyzeNames(IdentifierScope identScope,
			MethodScope methodScope, ClassScope classScope)
			throws NamingException {
		identScope.declare(this);
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#computeType()
	 */
	@Override
	@Deprecated
	public Type computeType() throws TypingException {
		return this.typ;
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#getLocalVar()
	 */
	@Override
	@Deprecated
	public int getLocalVar() {
		return this.localVar;
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#generateCode(code.CodeList)
	 */
	@Override
	@Deprecated
	public void generateCode(CodeList code) {
		code.generateCode(Opcode.STORE, getLocalVar());
	}

}
